package day4;

import java.util.Scanner;

import org.junit.Test;

public class Demo {

	@Test
	public void test1() {
		//Scanner scanner = new Scanner(System.in);
		//scanner.nextInt();
		// 类型 变量;
		Student student1 = new Student();
		// The field Student.id is not visible.  view
		student1.id = 1;
		student1.name = "zhansgan";
		student1.age = 223;
		student1.gender = "男";
		// 调用方法：对象.方法名
		student1.study();
		
		Student student2 = new Student();
		student2.id = 2;
		student2.name = "lisi";
		student2.age = 34;
		student2.gender = "女";
		student2.study();
	}
	
	@Test
	public void test4() {
		Student student = new Student();
		student.setId(1);
		student.setName("张三");
		// student.age = 23;
		student.setAge(223);
		student.setGender("男");
		
		int id = student.getId();
		String name = student.getName();
		int age = student.getAge();
		String gender = student.getGender();
		
		//System.out.println("Student[id:" + id + ", name:" + name + ", age:" + age + ", gender:" + gender + "]");
		System.out.println(student.toString());
		System.out.println(student);
	}
	
	@Test
	public void test5() {
		Student student;// null
		String str; // null
		int[] array;// null
	}
	
	@Test
	public void test6() {
		Teacher teacher = new Teacher();
		System.out.println(teacher.num);// 0
		System.out.println(teacher.money);// 0.0
		System.out.println(teacher.flag);// false
		
		System.out.println(teacher.array);// null
		System.out.println(teacher.name);// null
		System.out.println(teacher.student);// null
		
		teacher = null;
		// null.name  
		// null.属性    null.方法()
		// java.lang.NullPointerException
		System.out.println(teacher.name);
	}
	
	
	@Test
	public void test8() {
		Person person = new Person();
		person.setId(1);
		person.setName("zhangsan");
		person.setAge(23);
		
		int age = person.getAge();
		
		System.out.println(person.toString());
		System.out.println(person);
	}
	
	@Test
	public void test66() {
		Student student = new Student();
		student.setId(1);
		student.setName("张三");
		student.setAge(223);
		student.setGender("男");
		
		Student student2 = new Student(2, "李四", 23, "女");
		int age = student2.getAge();
		System.out.println(student2);
		
	}
	
}
